const mongoose =require('mongoose')
const uuid = require('uuid');
const userSchema = new mongoose.Schema({
  username:{
    type:String,
    required: true
  },
  password:{
    type:String,
    required: true
  },
  UserId: {
    type: String,
    default: uuid.v4
  },
  OrgId: {
    type: String,
    default: uuid.v4
  }
})
const userModel = mongoose.model('users',userSchema)

const userDetailsSchema = new mongoose.Schema({
  UserId:{
    type: String,
    require: true
  },
  Avatar:{
    type:String
  },
  Roles: {
    type: [String],
  },
  Age: {
    type: Number
  },
  NickName: {
    type: String
  },
  RelaName: {
    type: String
  },
  OrgId: {
    type: String
  }
})
const userDetailModel = mongoose.model('userdetails',userDetailsSchema)
module.exports = {
  userModel,
  userDetailModel
}